package com.domino.shared.model;

import java.io.Serializable;

public enum Color implements Serializable {

	BLACK(0), WHITE(1) ;
	 
	private int id;
	private static Color[] colors = {BLACK, WHITE};

	private Color()
	{
		
	}
			
	private Color(int id) {
		 this.id = id;
	 }

	public int getId() {
		return id;
	}
	
	public static Color fromId(int id) {
		try {
			return colors[id];
		} catch (ArrayIndexOutOfBoundsException e) {
			return null;
		}
	}

	public static Color getOpposite(Color color) {
		return Color.BLACK.equals(color)?Color.WHITE:Color.BLACK;
	}
	
	
}
